package org.hxzon.project;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class IbatisDao extends SqlMapClientDaoSupport {

    public void delete(String sqlId) {
        this.getSqlMapClientTemplate().delete(sqlId);
    }

    public void delete(String sqlId, Object param) {
        this.getSqlMapClientTemplate().delete(sqlId, param);
    }

    public void insert(String sqlId) {
        this.getSqlMapClientTemplate().insert(sqlId);
    }

    public void insert(String sqlId, Object param) {
        this.getSqlMapClientTemplate().insert(sqlId, param);
    }

    public void update(String sqlId) {
        this.getSqlMapClientTemplate().update(sqlId);
    }

    public void update(String sqlId, Object param) {
        this.getSqlMapClientTemplate().update(sqlId);
    }

    public <M> M find(Class<M> clazz, String sqlId) {
        return (M) this.getSqlMapClientTemplate().queryForObject(sqlId);
    }

    public <M> M find(Class<M> clazz, String sqlId, Object param) {
        return (M) this.getSqlMapClientTemplate().queryForObject(sqlId, param);
    }

    public <M> List<M> list(Class<M> clazz, String sqlId) {
        return (List<M>) this.getSqlMapClientTemplate().queryForList(sqlId);
    }

    public <M> List<M> list(Class<M> clazz, String sqlId, Object param) {
        return (List<M>) this.getSqlMapClientTemplate().queryForList(sqlId, param);
    }

    public long count(String sqlId) {
        return (Long) this.getSqlMapClientTemplate().queryForObject(sqlId);
    }

    public long count(String sqlId, Object param) {
        return (Long) this.getSqlMapClientTemplate().queryForObject(sqlId, param);
    }

}
